home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / Re Reading Formatted Text.1 < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.1 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Reading Formatted Text
  2. Sent:        6/10/96 10:24 PM
  3. Received:    6/11/96 9:12 AM
  4. From:        Jim Lloyd, jim@melongem.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. At 6:32 PM 6/10/96, Serge Froment wrote:
  9. >Dear ODF Team:
  10. >
  11. >What is the proper way to read tab-delimited formatted text from the
  12. >clipboard. I want to loop, reading up to the next tab or return and parsing
  13. >the text.
  14. >
  15. >I have looked at FW_CString, which has methods for searching a character,
  16. >and FW_CTextReader, which don't have such methods. I am not clear if I must
  17. >use one or the other, or both.
  18.  
  19. As you've noticed, ODF R1 doesn't provide anything that exactly meets your
  20. needs. FW_CTextReader is the most appropriate ODF class for this task.  The
  21. idea is to create tool classes that use TextReader interfaces.  For
  22. example, you might write a lexical analyzer class along these lines:
  23.  
  24.  
  25. class CLexicalAnalyzer
  26. {
  27. public:
  28.     CLexicalAnalyzer(FW_CTextReader& reader);
  29.         // create an analyzer and attach it to the given text reader
  30.  
  31.     void SkipWhiteSpace();
  32.     void ReadString(FW_CString& string);
  33.     ....
  34.  
  35. private:
  36.     FW_CTextReader& fReader;
  37. };
  38.  
  39. By using the FW_CTextReader interface, you'll be able to use this tool for
  40. reading from any source of text.
  41. To read text from the clipboard you would either create a subclass of
  42. FW_OTextRunReader for reading directly from the clipboard, or read the
  43. entire clipboard into a memory block and use FW_OMemoryRunReader.
  44.  
  45. Note, FW_CTextReader and FW_CSink have some similarities.  FW_CTextReader
  46. is designed for reading text, including dealing with double-byte
  47. characters.  FW_CSink is purely for binary data in the form of bytes.
  48. FW_CReadableStream is a layer on top of FW_CSink for reading data at a
  49. higher level, such as integers and strings (and polymorpic objects via the
  50. archiver).  The CLexicalAnalyzer class is similar in some respects to
  51. FW_CReadableStream; i.e. a layer for reading data at a higher level of
  52. abstraction.  ODF R1 doesn't provide any classes built on top of
  53. FW_CTextReader, though it was something we considered doing at one time.
  54.  
  55. Jim Lloyd
  56.  
  57.